import { defineConfig } from 'vitepress';
import generateSidebar from './generateSidebar.js';
import path from 'path';

// 获取文档根目录
const docsDir = path.resolve(__dirname, '..');

// 生成侧边栏配置
const sidebar = generateSidebar(docsDir, 'api');

export default defineConfig({
  base: '/docs/',
  title: '@t1h0/tt 文档',
  description: '@t1h0/tt 库的使用文档',
  vite: {
    server: {
      // open: true
    }
  },
  themeConfig: {
    nav: [
      { text: '首页', link: '/' },
      { text: 'API文档', link: '/api/README.md' },
      { text: '我', link: 'https://t1h0.top' }
    ],
    sidebar: {
      '/api/': sidebar
    }
  }
});